package org.zjx.command.entity.screen;

import lombok.Data;

import java.awt.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;

@Data
public class Npc implements Serializable {
    public final String sceneName;
    public final String name;
    public final List<Point> movePath = new ArrayList<>();
    public final Map<String, List<String>> functions = new HashMap<>();

    public Npc(String sceneName, String name) {
        this.sceneName = sceneName;
        this.name = name;
    }

    public Npc addMovePath(Point point) {
        movePath.add(point);
        return this;
    }

    public Npc addFunction(String type, List<String> content) {
        functions.put(type, content);
        return this;
    }

    public Address getMainLocation() {
        if (movePath.isEmpty()) return null;
        return new Address(sceneName, movePath.get(0).x, movePath.get(0).y);
    }
}
